# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-aiofiles
_pkgname=aiofiles
pkgver=0.8.0
pkgrel=2
pkgdesc="File support for asyncio"
url="https://github.com/Tinche/aiofiles"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="py3-build py3-installer py3-poetry-core"
checkdepends="py3-pytest py3-pytest-asyncio"
source="$_pkgname-$pkgver.tar.gz::https://github.com/Tinche/aiofiles/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	# XXX: hack for poetry to not ignore files
	GIT_DIR=. python3 -m build --no-isolation --wheel
}

check() {
	python3 -m installer -d testenv \
		dist/aiofiles-$pkgver-py3-none-any.whl
	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
	PYTHONPATH="$PWD/testenv/$sitedir" python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/aiofiles-$pkgver-py3-none-any.whl
}

sha512sums="
4f590baa0369d465a6139c0d4f50beeec60f8f213b607e0e41598f45f507a12edc67b29c77718b03eee7532f10ead8599f55aac3fcb78d0429435c25a58f6d2e  aiofiles-0.8.0.tar.gz
"
